package com.cddx.logistics.mapper;

import com.cddx.logistics.domain.dto.InventoryQueryDTO;
import com.cddx.logistics.domain.vo.InventoryVO;
import com.cddx.logistics.domain.vo.MaterialInfoVO;
import com.cddx.logistics.domain.vo.StorageLocationVO;
import com.cddx.logistics.domain.vo.WarehouseVO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface InventoryMapper {
    List<InventoryVO> queryPage(InventoryQueryDTO queryDTO);

    List<WarehouseVO> listAllWarehouses();

    List<StorageLocationVO> listAllStorageLocations();

    List<StorageLocationVO> listStorageLocationsByWarehouse(@Param("warehouseId") Long warehouseId);


    Boolean transferUpdate(@Param("materialId") Long materialId, @Param("locationPreId") Long locationPreId, @Param("locationAfterId") Long locationAfterId, @Param("quantity") Float quantity, @Param("weight") Float weight, @Param("volume") Float volume);


    Float getQuantity(@Param("locationPreId") Long locationPreId, @Param("materialId") Long materialId);

    boolean checkExists(@Param("materialId") Long materialId, @Param("locationAfterId") Long locationAfterId);


    boolean insert(@Param("materialId") Long materialId, @Param("warehouseId") Long warehouseId,
                   @Param("storageLocationId") Long storageLocationId,
                   @Param("inventoryBatchNumber") String inventoryBatchNumber,
                   @Param("inventoryQuantity") float inventoryQuantity,
                   @Param("inventoryUnit") String inventoryUnit,
                   @Param("inventoryTotalWeight") float inventoryTotalWeight,
                   @Param("inventoryTotalVolume") float inventoryTotalVolume);

    @MapKey("warehouseId")
    List<Map<String, Object>> getWarehouseCapacityStats();//获取仓库容积统计数据
}